<template>
  <div class="oddQueryContent">
    <div class="oddQueryTitle">
      <!-- <div class="customerTitle">海川医药零货上架{{ systemTime }}日报</div> -->
      <div class="customerTitle">海川医药零货上架{{ dateTransfer }}日报</div>
      <!-- <div class="searchBtn">
        <el-date-picker
          v-model="dateRange"
          style="width: 240px"
          value-format="yyyy-MM-dd"
          type="date"
        ></el-date-picker>
        <el-button type="success" @click="handleOddsearch">搜索</el-button>
      </div> -->
    </div>
    <div class="oddtable">
      <div class="customtr1">
        <div class="customText">客户</div>
        <div class="delivery">
          <div class="deliveryTop">完成</div>
          <div class="deliveryBottom">
            <span>补货(件)</span>
            <span>零货(条)</span>
            <span>内部倒货(条)</span>
          </div>
        </div>
        <div class="delivery">
          <div class="deliveryTop">未完成</div>
          <div class="deliveryBottom">
            <span>补货(件)</span>
            <span>零货(条)</span>
            <span>内部倒货(条)</span>
          </div>
        </div>
        <div class="customText">异常(件/条)</div>
        <div class="completeText">完成时间点</div>
      </div>
      <div class="customtr2">
        <div class="customText wyLayout">陕西海通</div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
              disabled
              @input="calculateWcbhTotal"
              v-model="form.htWcBh"
              size="medium"
            />
          </div>
        </div>
        <div class="customText">
          <el-input
          disabled
            @input="calculateWclhTotal"
            v-model="form.htWcLh"
            size="medium"
          />
        </div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
            disabled
              v-model="form.htWcNbdh"
              @input="calculateWcnbdhTotal"
              size="medium"
            />
          </div>
        </div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
            disabled
              @input="calculateWwcbhTotal"
              v-model="form.htWwcBh"
              size="medium"
            />
          </div>
        </div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
            disabled
              @input="calculateWwclhTotal"
              v-model="form.htWwcLh"
              size="medium"
            />
          </div>
        </div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
            disabled
              @input="calculateWwcnbdhTotal"
              v-model="form.htWwcNbdh"
              size="medium"
            />
          </div>
        </div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
            disabled
              @input="calculateycTotal"
              v-model="form.htYc"
              size="medium"
            />
          </div>
        </div>
        <div class="delivery">
          <div class="deliveryTop noborder">
            <el-time-picker
            disabled
              v-model="form.htWcsjd"
              placeholder=""
              value-format="HH:mm"
              format="HH:mm"
            >
            </el-time-picker>
          </div>
        </div>
      </div>
      <div class="customtr2">
        <div class="customText wyLayout">陕西伟业</div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
            disabled
              @input="calculateWcbhTotal"
              v-model="form.wyWcBh"
              size="medium"
            />
          </div>
        </div>
        <div class="customText">
          <el-input
          disabled
            @input="calculateWclhTotal"
            v-model="form.wyWcLh"
            size="medium"
          />
        </div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
            disabled
              v-model="form.wyWcNbdh"
              @input="calculateWcnbdhTotal"
              size="medium"
            />
          </div>
        </div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
            disabled
              @input="calculateWwcbhTotal"
              v-model="form.wyWwcBh"
              size="medium"
            />
          </div>
        </div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
            disabled
              @input="calculateWwclhTotal"
              v-model="form.wyWwcLh"
              size="medium"
            />
          </div>
        </div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
            disabled
              @input="calculateWwcnbdhTotal"
              v-model="form.wyWwcNbdh"
              size="medium"
            />
          </div>
        </div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
            disabled
              @input="calculateycTotal"
              v-model="form.wyYc"
              size="medium"
            />
          </div>
        </div>
        <div class="delivery">
          <div class="deliveryTop noborder">
            <el-time-picker
            disabled
              v-model="form.wyWcsjd"
              placeholder=""
              value-format="HH:mm"
              format="HH:mm"
            >
            </el-time-picker>
          </div>
        </div>
      </div>
      <div class="customtr3">
        <div class="customText wyLayout">其他货主</div>
        <div class="customText">
          <el-input
          disabled
            @input="calculateWcbhTotal"
            v-model="form.qtWcBh"
            size="medium"
          />
        </div>
        <div class="customText">
          <el-input
          disabled
            @input="calculateWclhTotal"
            v-model="form.qtWcLh"
            size="medium"
          />
        </div>
        <div class="customText">
          <el-input
          disabled
            v-model="form.qtWcNbdh"
            @input="calculateWcnbdhTotal"
            size="medium"
          />
        </div>
        <div class="customText">
          <el-input
          disabled
            @input="calculateWwcbhTotal"
            v-model="form.qtWwcBh"
            size="medium"
          />
        </div>
        <div class="customText">
          <el-input
          disabled
            @input="calculateWwclhTotal"
            v-model="form.qtWwcLh"
            size="medium"
          />
        </div>
        <div class="customText">
          <el-input
          disabled
            @input="calculateWwcnbdhTotal"
            v-model="form.qtWwcNbdh"
            size="medium"
          />
        </div>
        <div class="customText">
          <el-input
          disabled
            @input="calculateycTotal"
            v-model="form.qtYc"
            size="medium"
          />
        </div>
        <div class="completeText">
          <el-time-picker
          disabled
            v-model="form.qtWcsjd"
            placeholder=""
            value-format="HH:mm"
            format="HH:mm"
          >
          </el-time-picker>
        </div>
      </div>
      <div class="customtr4">
        <div class="customText wyLayout">合计</div>
        <!-- <div class="customText"></div> -->
        <div class="customText">
          <el-input disabled v-model="wcbhTotal" size="medium" />
        </div>
        <div class="customText">
          <el-input disabled v-model="wclhTotal" size="medium" />
        </div>
        <div class="customText">
          <el-input disabled v-model="wcnbdhTotal" size="medium" />
        </div>
        <div class="customText">
          <el-input disabled v-model="wwcbhTotal" size="medium" />
        </div>
        <div class="customText">
          <el-input disabled v-model="wwclhTotal" size="medium" />
        </div>
        <div class="customText">
          <el-input disabled v-model="wwcnbdhTotal" size="medium" />
        </div>
        <div class="customText">
          <el-input disabled v-model="ycTotal" size="medium" />
        </div>
        <div class="completeText"></div>
      </div>
    </div>
  </div>
</template>

<script>
import { dailyscreenlistodd } from "@/api/system/daily";
export default {
    props: {
      dateTransfer: {
        type: String,
      },
    },
  data() {
    return {
      // 日期范围
      dateRange: new Date().toISOString().split("T")[0],
      // 陕西海通零货条目数
      ids: null,
      systemTime: "",
      wcbhTotal: undefined,
      wclhTotal: undefined,
      wcnbdhTotal: undefined,
      wwcbhTotal: undefined,
      wwclhTotal: undefined,
      wwcnbdhTotal: undefined,
      ycTotal: undefined,
      form: {
        rbSj: new Date().toISOString().split("T")[0],
        // 海通
        htWcBh: null,
        htWcLh: null,
        htWcNbdh: null,
        htWwcBh: null,
        htWwcLh: null,
        htWwcNbdh: null,
        htYc: null,
        htWcsjd: null,
        // 伟业
        htWcBh: null,
        htWcLh: null,
        htWcNbdh: null,
        htWwcBh: null,
        htWwcLh: null,
        htWwcNbdh: null,
        htYc: null,
        htWcsjd: null,
        // 其他
        qtWcBh: null,
        qtWcLh: null,
        qtWcNbdh: null,
        qtWwcBh: null,
        qtWwcLh: null,
        qtWwcNbdh: null,
        qtYc: null,
        qtWcsjd: null,
      },
    };
  },
  mounted() {
    // 创建一个 Date 对象
    const currentDate = new Date();
    // 获取当前年份
    const year = currentDate.getFullYear();
    // 获取当前月份（注意：月份是从 0 开始计数的，所以需要加 1）
    const month = currentDate.getMonth() + 1;
    // 获取当前日期
    const day = currentDate.getDate();
    // 打印年月日
    this.systemTime = `${year}年${month}月${day}日`;
  },
  beforeDestroy() {},
  methods: {
    handleOddsearch() {
      dailyscreenlistodd({ rbSj: this.dateTransfer }).then((res) => {
        if (res.data) {
          this.form = res.data;
          this.wcbhTotal =
            Number(this.form.htWcBh) +
            Number(this.form.wyWcBh) +
            Number(this.form.qtWcBh);
          this.wclhTotal =
            Number(this.form.htWcLh) +
            Number(this.form.wyWcLh) +
            Number(this.form.qtWcLh);
          this.wcnbdhTotal =
            Number(this.form.htWcNbdh) +
            Number(this.form.wyWcNbdh) +
            Number(this.form.qtWcNbdh);
          this.wwcbhTotal =
            Number(this.form.htWwcBh) +
            Number(this.form.wyWwcBh) +
            Number(this.form.qtWwcBh);
          this.wwclhTotal =
            Number(this.form.htWwcLh) +
            Number(this.form.wyWwcLh) +
            Number(this.form.qtWwcLh);
          this.wwcnbdhTotal =
            Number(this.form.htWwcNbdh) +
            Number(this.form.wyWwcNbdh) +
            Number(this.form.qtWwcNbdh);
          this.ycTotal =
            Number(this.form.htYc) +
            Number(this.form.wyYc) +
            Number(this.form.qtYc);
        }
      });
    },
    calculateWcbhTotal() {
      this.wcbhTotal =
        Number(this.form.htWcBh) +
        Number(this.form.wyWcBh) +
        Number(this.form.qtWcBh);
    },
    calculateWclhTotal() {
      this.wclhTotal =
        Number(this.form.htWcLh) +
        Number(this.form.wyWcLh) +
        Number(this.form.qtWcLh);
    },
    calculateWcnbdhTotal() {
      this.wcnbdhTotal =
        Number(this.form.htWcNbdh) +
        Number(this.form.wyWcNbdh) +
        Number(this.form.qtWcNbdh);
    },
    calculateWwcbhTotal() {
      this.wwcbhTotal =
        Number(this.form.htWwcBh) +
        Number(this.form.wyWwcBh) +
        Number(this.form.qtWwcBh);
    },
    calculateWwclhTotal() {
      this.wwclhTotal =
        Number(this.form.htWwcLh) +
        Number(this.form.wyWwcLh) +
        Number(this.form.qtWwcLh);
    },
    calculateWwcnbdhTotal() {
      this.wwcnbdhTotal =
        Number(this.form.htWwcNbdh) +
        Number(this.form.wyWwcNbdh) +
        Number(this.form.qtWwcNbdh);
    },
    calculateycTotal() {
      this.ycTotal =
        Number(this.form.htYc) +
        Number(this.form.wyYc) +
        Number(this.form.qtYc);
    },
  },
};
</script>

<style lang="scss" scoped>
.oddQueryContent {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  ::v-deep .el-table--enable-row-hover .el-table__body tr:hover > td {
    background-color: transparent;
  }

  ::v-deep .el-date-editor.el-input,
  .el-date-editor.el-input__inner {
    width: 100%;
  }
  .oddQueryTitle {
    width: 100%;
    text-align: center;
    .customerTitle {
      width: 100%;
      font-size: 30px;
      font-weight: 700;
      margin: 10px 0 20px 0;
    }
    ::v-deep .el-button--success {
      height: 36px;
      margin-left: 30px;
    }
  }
  .oddtable {
    width: 80%;
    margin-top: 20px;
    ::v-deep .el-input__inner {
      height: 65px;
      line-height: 65px;
      border: none;
      text-align: center;
      color: #000000;
      width: 100%;
    }
    .customtr1 {
      width: 100%;
      height: 140px;
      border: 1px solid #e7dfdf;
      background: #05a5ff;
      display: flex;
      font-size: 16px;
      font-weight: 700;
      color: #ffffff;
      justify-content: space-around;
      .customText {
        width: 11.1%;
        height: 140px;
        line-height: 140px;
        text-align: center;
        border-right: 1px solid #e7dfdf;
      }
      .completeText {
        width: 11.1%;
        height: 140px;
        line-height: 140px;
        text-align: center;
      }
      .delivery {
        width: 33.35%;
        display: flex;
        flex-direction: column;
        .deliveryTop {
          height: 50%;
          line-height: 70px;
          text-align: center;
          border-right: 1px solid #e7dfdf;
        }
        .deliveryBottom {
          height: 50%;
          display: flex;
          justify-content: space-around;
          border-top: 1px solid #e7dfdf;
          span {
            width: 34%;
            height: 100%;
            line-height: 70px;
            text-align: center;
            border-right: 1px solid #e7dfdf;
          }
        }
      }
    }
    .customtr2 {
      width: 100%;
      height: 70px;
      border-bottom: 1px solid #181616;
      border-left: 1px solid #181616;
      border-right: 1px solid #181616;
      // background: #00d9ff;
      display: flex;
      justify-content: space-around;
      .customText {
        width: 11.1%;
        height: 70px;
        line-height: 70px;
        text-align: center;
        border-right: 1px solid #181616;
      }
      .wyLayout {
        font-weight: 700;
      }
      .delivery {
        width: 11.1%;
        display: flex;
        flex-direction: column;
        //   border-right: 1px solid #181616;
        .deliveryTop {
          height: 100%;
          line-height: 70px;
          border-right: 1px solid #181616;
        }
        .noborder {
          border-right: none !important;
        }
        // .deliveryBottom {
        //   height: 50%;
        //   display: flex;
        //   line-height: 70px;
        //   justify-content: space-around;
        //   border-top: 1px solid #181616;
        //   border-right: 1px solid #181616;
        // }
      }
    }
    .customtr3 {
      width: 100%;
      height: 70px;
      border-bottom: 1px solid #181616;
      border-left: 1px solid #181616;
      border-right: 1px solid #181616;
      // background: #00d9ff;
      display: flex;
      justify-content: space-around;
      .customText {
        width: 11.1%;
        height: 70px;
        line-height: 70px;
        text-align: center;
        border-right: 1px solid #181616;
      }
      .totalText {
        width: 20%;
      }
      .wyLayout {
        font-weight: 700;
      }
      .completeText {
        width: 11.1%;
        height: 70px;
        line-height: 70px;
        text-align: center;
      }
    }
    .customtr4 {
      width: 100%;
      height: 70px;
      border-bottom: 1px solid #181616;
      border-left: 1px solid #181616;
      border-right: 1px solid #181616;
      background: #75d561;
      display: flex;
      justify-content: space-around;
      ::v-deep .el-input.is-disabled .el-input__inner {
        background: #75d561;
        font-weight: 700;
        color: #ff4800;
        font-size: 18px;
      }
      .customText {
        width: 11.1%;
        height: 70px;
        line-height: 70px;
        text-align: center;
        border-right: 1px solid #181616;
      }
      // .totalText {
      //   width: 11.1%;
      // }
      .bhxsbg {
        background: #f5f7fa;
        border-bottom: 1px solid #181616;
      }
      .wyLayout {
        font-weight: 700;
      }
      .completeText {
        background: #75d561;
        width: 11.1%;
        height: 70px;
        line-height: 70px;
        text-align: center;
        border-bottom: 1px solid #181616;
      }
    }
  }
}
</style>